package cn.spream.common.util;

import org.joda.time.DateTime;

import java.util.Date;

/**
 * 时间工具类
 * Created with IntelliJ IDEA.
 * User: sjx
 * Date: 13-6-19
 * Time: 下午10:30
 * To change this template use File | Settings | File Templates.
 */
public class DateUtils {

    /**
     * 格式化日期
     *
     * @param date
     * @param pattern
     * @return
     */
    public static String format(Date date, String pattern) {
        return toDateTime(date).toString(pattern);
    }

    /**
     * 格式化日期
     *
     * @param date
     * @return
     */
    public static String format(Date date) {
        return toDateTime(date).toString();
    }

    /**
     * 转化为DateTime类型
     *
     * @param date
     * @return
     */
    public static DateTime toDateTime(Date date) {
        return new DateTime(date);
    }

}
